package com.zkkz.boot.campus.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zkkz.boot.campus.mapper.UserMapper;
import com.zkkz.boot.campus.pojo.ResultResp;
import com.zkkz.boot.campus.pojo.User;
import com.zkkz.boot.campus.utils.MinioUpload;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author tsj
 * DatasourceInstance
 * Fri Jul 26 02:16:10 CST 2024
 * @since 2024-07-26
 */
@Slf4j
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> {
    @Resource
    private UserMapper userMapper;
    @Resource
    private MinioUpload minioUpload;

    public ResultResp testRemoteCallCampusTest() {
        User user = new User();
        try {
            user = userMapper.selectById(2);
//            user = userMapper.selectById1(2);

        } catch (Exception e) {
            log.error("测试restTemplate失败", e);
            e.printStackTrace();
        }
        return new ResultResp(user);

    }

    public ResultResp uploadMinioFile(MultipartFile file) throws Exception {
        return new ResultResp(minioUpload.uploadMinioFile(file));
    }
}
